<?php
include 'user_update_lib.php';

$a_css_files = array (
    array ( 'path' => 'plugins/jquery-ui/jquery-ui-1.10.1.custom.min.css' ),
    array ( 'path' => 'plugins/bootstrap-modal/css/bootstrap-modal.css' ),
    array ( 'path' => 'plugins/jquery-multi-select/css/multi-select-metro.css' ),
);

$a_js_files = array (
    array ( 'path' => 'plugins/jquery-validation/dist/jquery.validate.min.js' ),
    array ( 'path' => 'plugins/bootstrap-wizard/jquery.bootstrap.wizard.min.js' ),
    array ( 'path' => 'plugins/jquery-file-upload/js/vendor/tmpl.min.js' ),
    array ( 'path' => 'plugins/bootstrap-modal/js/bootstrap-modal.js' ),
    array ( 'path' => 'plugins/bootstrap-modal/js/bootstrap-modalmanager.js' ),
    array ( 'path' => 'plugins/jquery-multi-select/js/jquery.multi-select.js' ),
    array ( 'path' => 'scripts/nh-user-update.js' ),
);

$a_js_class[] = 'User_Form.init();';

include 'lib_head.php';
?>
<div id="ajax-modal" class="modal hide fade" tabindex="-1"></div>
<div class="row-fluid">
    <div class="form-wizard" id="form_wizard">
        <div class="navbar steps">
            <div class="navbar-inner">
                <ul class="row-fluid">
                    <li class="span6">
                        <a href="#tab1" data-toggle="tab" class="step ">
                            <span class="number">1</span>
                            <span class="desc"><i class="icon-ok"></i> Chọn Dữ Liệu</span>   
                        </a>
                    </li>
                    <li class="span6">
                        <a href="#tab2" data-toggle="tab" class="step">
                            <span class="number">2</span>
                            <span class="desc"><i class="icon-ok"></i> Cập Nhật Dữ Liệu</span>   
                        </a>
                    </li>
                </ul>
            </div>
        </div>
        <div id="bar" class="progress progress-success progress-striped">
            <div class="bar process-bar"></div>
        </div>
        <div class="tab-content">
            <div class="tab-pane" id="tab1">
                <h3 class="block">Khóa <?= $a_KhoaHoc_Info['name'] ?></h3>
                <form action="user_update_execute.php?action=get-user" method="post" id="form-1" >
                    <div class="span3">
                        <div class="control-group">
                            <label class="control-label" >Phân Loại</label>
                            <div class="controls">
                                <select name="usertype" class="span12" id="usertype">
                                    <?php foreach ($a_Loai_TaiKhoan as $v_key => $v_value) { ?>
                                        <option <?= $s_category6 == $v_key ? 'selected="selected"' : '' ?> value="<?= $v_key ?>"><?= $v_value ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="span3">
                        <div class="control-group">
                            <label class="control-label" >Ngành</label>
                            <div class="controls">
                                <select name="category_team" class="m-wrap span12">
                                    <?php foreach ($a_Nganh as $v_key => $v_value) { ?>
                                        <option <?= $s_category_team == $v_key ? 'selected="selected"' : '' ?> value="<?= $v_key ?>"><?= $v_value ?></option>
                                    <?php } ?>
                                    <option value="">Tất Cả</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="span3">
                        <div class="control-group">
                            <label class="control-label" >Cấp</label>
                            <div class="controls">
                                <select name="category_level" class="m-wrap span12">
                                    <option value=""></option>
                                    <?php foreach ($a_Cap as $v_key => $v_value) { ?>
                                        <option <?= $s_category_level == $v_key ? 'selected="selected"' : '' ?> value="<?= $v_key ?>"><?= $v_value ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="span3">
                        <div class="control-group">
                            <label class="control-label" >Đội</label>
                            <div class="controls">
                                <select name="category_crew" class="m-wrap span12">
                                    <option value=""></option>
                                    <?php foreach ($a_Doi as $v_key => $v_value) { ?>
                                        <option <?= $s_category_crew == $v_key ? 'selected="selected"' : '' ?> value="<?= $v_key ?>"><?= $v_value ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="tab-pane" id="tab2">
                <form action="user_update_execute.php?action=update" method="post" id="form-2" >
                    <div class="control-group">
                        <div class="controls text-center">
                            <select multiple="multiple" id="user_multi_select" class="span12" name="userid[]">
                            </select>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div class="form-actions clearfix">
            <a href="javascript:;" class="btn button-previous">
                <i class="m-icon-swapleft"></i> Quay Lại 
            </a>
            <a href="javascript:;" class="btn blue button-next">
                Tiếp Tục <i class="m-icon-swapright m-icon-white"></i>
            </a>
            <a href="javascript:;" class="btn blue" id="modal_ajax_update_eucharist_date">
                Ngày Rước Lễ Lần Đầu
            </a>
            <a href="javascript:;" class="btn red" id="modal_ajax_update_confirmation_date">
                Ngày Thêm Sức
            </a>
            <a href="javascript:;" class="btn green" id="modal_ajax_update_new_class">
                Lớp Học Khóa <?= $a_KhoaHoc_Info['start_year'] + 1 ?> - <?= $a_KhoaHoc_Info['start_year'] + 2 ?>
            </a>
        </div>
    </div>
</div>
<script id="user-tmpl" type="text/x-tmpl">
    {% for (Team_ID in o) { %}
    {% for (Level_ID in o[Team_ID]) { %}
    {% for (Crew_ID in o[Team_ID][Level_ID]) {
    _tmp_team = '';
    if  ( Team_ID    in o_team   ) { _tmp_team =                     o_team[Team_ID]    ; }
    if  ( Level_ID   in o_level  ) { _tmp_team = _tmp_team + ' - ' + o_level[Level_ID]  ; }
    if  ( Crew_ID    in o_crew   ) { _tmp_team = _tmp_team + ' - ' + o_crew[Crew_ID]    ; }
    %}
    <optgroup label="{%=_tmp_team%}">
        {% for (User_ID in o[Team_ID][Level_ID][Crew_ID]) { %}
        <option value="{%=User_ID%}">{%=o[Team_ID][Level_ID][Crew_ID][User_ID].saint%} {%=o[Team_ID][Level_ID][Crew_ID][User_ID].username%}</option>
        {% } %}
    </optgroup>
    {% } %}
    {% } %}
    {% } %}
</script>
<script type="text/javascript">
    var o_team  = <?= json_encode($a_Nganh) ?>;
    var o_level = <?= json_encode($a_Cap) ?>;
    var o_crew  = <?= json_encode($a_Doi) ?>;
</script>
<?php include 'lib_tail.php'; ?>